package myapps.ttclient.protocol.message.powerpoint;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import myapps.ttclient.Helper;
import myapps.ttclient.baseclass_and_interface.TTClientMessage;
import myapps.ttclient.struct.SlideDataStruct;


public class PPTSlideShowDataResponseMessage extends TTClientMessage
{
	public String temporaryKey = "";

	public SlideDataStruct[] data;

	public PPTSlideShowDataResponseMessage(String temporaryKey, SlideDataStruct[] data)
	{
		this.temporaryKey = temporaryKey;
		this.data = data;
	}

	public static TTClientMessage parse(DataInputStream dis) throws IOException
	{
		String key = Helper.ParseAsString(dis);

		int slideCount = dis.readInt();

		SlideDataStruct[] data = new SlideDataStruct[slideCount];

		for(int i = 0; i < slideCount; i++)
		{
			data[i] = new SlideDataStruct();
			data[i].slideIndex = i;
			data[i].slideTitle = Helper.ParseAsString(dis);
		}

		return new PPTSlideShowDataResponseMessage(key, data);
	}

	@Override
	public void toDataOutputStream(DataOutputStream dos) throws IOException
	{
		throw new IOException("NotImplementedException");
	}
}